from django.db import models
from apps.common.base.models import BaseModel
from apps.merchant.shop.models import Shop

class Cate(BaseModel):
    shop = models.ForeignKey(Shop, related_name="shop_cate", verbose_name='分类',
                             on_delete=models.SET_NULL, null=True, blank=True, db_constraint=False)
    parent = models.ForeignKey('self', related_name='parent_cate', verbose_name='上级分类', on_delete=models.SET_NULL,
                               null=True, blank=True, db_constraint=False)

    name = models.CharField("类目名称", max_length=200, blank=True, default='')
    key = models.CharField("关键字", max_length=200, blank=True, default='')


    class Meta:
        verbose_name = 'Cate'
        verbose_name_plural = verbose_name
